import { ComponentInternalInstance, getCurrentInstance } from 'vue'

export default function useAppInstance() {
    const context = getCurrentInstance()
    if (!context) {
        throw new Error('useCurrentInstance() can only be used inside setup() or functional components!')
    }
    const { appContext } = context as ComponentInternalInstance
    const AppProxy = appContext.config.globalProperties
    return {
        AppProxy
    }
}
